mod vec3;
pub use vec3::{*, types::*};


pub fn write_color(c: Color, samples_per_pixel: i32) {
   
    let (mut r,mut g, mut b)  = (c.x(),c.y(),c.z());

    // Divide the color by the number of samples and gamma-correct for gamma=2.0
    let scale = 1.0 /(samples_per_pixel as f32);
    r = (r *scale).sqrt();
    g = (g *scale).sqrt();
    b = (b *scale).sqrt();

    let m = |v:f32| (256 as f32 * v.clamp(0.0, 0.999)) as i32;
    
    println!("{} {} {}", m(r),m(g),m(b));
}